/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dp1.titandevelop.titano.view.prod;

import dp1.titandevelop.titano.bean.Estado;
import dp1.titandevelop.titano.persistent.AlmacenXProducto;
import dp1.titandevelop.titano.persistent.Producto;
import dp1.titandevelop.titano.persistent.TipoProducto;
import dp1.titandevelop.titano.service.AlmacenService;
import dp1.titandevelop.titano.service.AlmacenXProductoService;
import dp1.titandevelop.titano.service.ProductoService;
import dp1.titandevelop.titano.service.ValidacionService;
import dp1.titandevelop.titano.view.admin.Carga_Masiva_Emp;
import java.awt.Dimension;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.table.AbstractTableModel;


/**
 *
 * @author cHreS
 */
public class ModulosT_PRO_Productos extends javax.swing.JInternalFrame {

    ProductoService sp = new ProductoService();
    private ArrayList<Producto> listaProductos;
    private ArrayList<TipoProducto> listaTipos;
    private ArrayList<String> listaTiposString;
    Producto prod;   
    
    public ModulosT_PRO_ProductosEdita1 ventanaEdita;
    
    //Refrescar la tabla de productos
    public void RefrescarTabla() {
        AbstractTableModel aux = (AbstractTableModel) tblProductos.getModel();
        aux.fireTableDataChanged();
    }
    
    
    //habilitar y deshabilitar botones para actualizar y eliminar
    public void habilitaBotones(){
        this.btnEditarP.setEnabled(true);
        this.btnEliminarP.setEnabled(true);
        this.btnAlmacen.setEnabled(true);
        if (this.prod.getToTipoProducto().getIdtipoproducto()==1)
            this.btnProveedor.setEnabled(true);
        else this.btnProveedor.setEnabled(false);
    }

    public void inhabilitaBotones() {
        this.btnEditarP.setEnabled(false);
        this.btnEliminarP.setEnabled(false);
        this.btnAlmacen.setEnabled(false);
        this.btnProveedor.setEnabled(false);
    }
    
    private AbstractTableModel modeloProductos;
        
        
    public ModulosT_PRO_Productos() {
        this.modeloProductos = new AbstractTableModel () {

public int getRowCount() {
return listaProductos.size();
}

public int getColumnCount() {
return 5;
}

String [] titles = {"Descripción","Tipo","Beneficio", "Costo", "UM"};

@Override
public String getColumnName(int col){
return titles[col];
}

public Object getValueAt(int rowIndex, int columnIndex) {
//String res=null;
Producto p=listaProductos.get(rowIndex);


//int stock=sp.Stock(p.getIdproducto());
switch (columnIndex){
case 0: return p.getDescripcion();
case 1: return p.getToTipoProducto().getDescripcion(); 
case 2: return p.getBeneficio();
case 3: return p.getCosto();
case 4: return p.getUm();
}
return null;
} 
};
        initComponents();
        ValidacionService validacionService = new ValidacionService();
        validacionService.SLetras(txtDescripcion);
        this.listaProductos = new ArrayList<Producto>();
        this.listaTiposString = new ArrayList<String>();
        this.listaTipos = sp.buscarTodoLosTipos();//new ArrayList<TipoProducto>();
        this.tblProductos.setModel(this.modeloProductos);
        inhabilitaBotones();
        listaTiposString.add("Seleccionar");
        for (int i=0; i<this.listaTipos.size(); i++)
        {
            listaTiposString.add(listaTipos.get(i).getDescripcion()); 
        }
        
        cmbTipoProd.setModel(new javax.swing.DefaultComboBoxModel(listaTiposString.toArray()));
        // this.RefrescarTabla();
 

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        lblProducto = new javax.swing.JLabel();
        txtDescripcion = new javax.swing.JTextField();
        cmbTipoProd = new javax.swing.JComboBox();
        lblTipoProducto = new javax.swing.JLabel();
        btnBuscar = new javax.swing.JButton();
        btnNuevo = new javax.swing.JButton();
        btnLimpiar = new javax.swing.JButton();
        btnSalir = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblProductos = new javax.swing.JTable();
        btnEditarP = new javax.swing.JButton();
        btnEliminarP = new javax.swing.JButton();
        btnProveedor = new javax.swing.JButton();
        btnAlmacen = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();

        setResizable(true);
        setTitle("Mantener Productos");

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Filtros de Búsqueda"));

        lblProducto.setText("Producto");

        cmbTipoProd.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbTipoProd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbTipoProdActionPerformed(evt);
            }
        });

        lblTipoProducto.setText("Tipo Producto");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblProducto)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtDescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lblTipoProducto)
                .addGap(18, 18, 18)
                .addComponent(cmbTipoProd, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblProducto)
                    .addComponent(txtDescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cmbTipoProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblTipoProducto))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/buscar.png"))); // NOI18N
        btnBuscar.setToolTipText("Buscar");
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        btnNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/nuevo.png"))); // NOI18N
        btnNuevo.setToolTipText("Nuevo");
        btnNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoActionPerformed(evt);
            }
        });

        btnLimpiar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/limpiar.png"))); // NOI18N
        btnLimpiar.setToolTipText("Limpiar");
        btnLimpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLimpiarActionPerformed(evt);
            }
        });

        btnSalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/retroceder.png"))); // NOI18N
        btnSalir.setToolTipText("Salir");
        btnSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalirActionPerformed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Resultados de Búsqueda"));

        tblProductos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Producto", "Beneficio", "Costo", "Unidad Medida"
            }
        ));
        tblProductos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblProductosMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tblProductos);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 549, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(18, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnEditarP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/editar.png"))); // NOI18N
        btnEditarP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEditarPActionPerformed(evt);
            }
        });

        btnEliminarP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/eliminar.png"))); // NOI18N
        btnEliminarP.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/img/eliminar.png"))); // NOI18N
        btnEliminarP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarPActionPerformed(evt);
            }
        });

        btnProveedor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/logistica.png"))); // NOI18N
        btnProveedor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnProveedorActionPerformed(evt);
            }
        });

        btnAlmacen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/almacen_1.png"))); // NOI18N
        btnAlmacen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAlmacenActionPerformed(evt);
            }
        });

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/texto.png"))); // NOI18N
        jButton1.setActionCommand("masivo");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 0)
                        .addComponent(btnNuevo)
                        .addGap(0, 0, 0)
                        .addComponent(btnLimpiar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSalir)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(10, 10, 10))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnAlmacen)
                        .addGap(1, 1, 1)
                        .addComponent(btnProveedor)
                        .addGap(1, 1, 1)
                        .addComponent(btnEditarP)
                        .addGap(1, 1, 1)
                        .addComponent(btnEliminarP)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnBuscar)
                    .addComponent(btnNuevo)
                    .addComponent(btnLimpiar)
                    .addComponent(btnSalir)
                    .addComponent(jButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btnEliminarP, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnEditarP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnAlmacen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(8, 8, 8))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
  
    private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
           
       String cad ;
       int index = cmbTipoProd.getSelectedIndex();
       if(index==0)
           cad=null;
       else
           cad=(String)cmbTipoProd.getSelectedItem();
       
       this.listaProductos = sp.buscarMulticriterio(txtDescripcion.getText(),cad);
       
       this.RefrescarTabla();
    }//GEN-LAST:event_btnBuscarActionPerformed

    private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoActionPerformed
        ModulosT_PRO.ventanaProductosNuevo = new ModulosT_PRO_ProductosNuevo1();
        this.getParent().add(ModulosT_PRO.ventanaProductosNuevo);
        Dimension desktopSize = this.getParent().getSize();
        Dimension jInternalFrameSize = ModulosT_PRO.ventanaProductosNuevo.getSize();
        ModulosT_PRO.ventanaProductosNuevo.setLocation((desktopSize.width - jInternalFrameSize.width) / 2,
            (desktopSize.height - jInternalFrameSize.height)/4 );
        ModulosT_PRO.ventanaProductosNuevo.show();
        ModulosT_PRO.AdmProductos=null;
        this.dispose();
    }//GEN-LAST:event_btnNuevoActionPerformed

    private void btnLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLimpiarActionPerformed
        txtDescripcion.setText("");
        cmbTipoProd.setSelectedItem(null);    
        this.listaProductos.clear();
        this.RefrescarTabla();
        this.inhabilitaBotones();
    }//GEN-LAST:event_btnLimpiarActionPerformed

    private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed
        this.dispose();
    }//GEN-LAST:event_btnSalirActionPerformed

    private void cmbTipoProdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbTipoProdActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cmbTipoProdActionPerformed

    private void btnEliminarPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarPActionPerformed
        // TODO add your handling code here:
      // TODO add your handling code here:
        ProductoService prods = new ProductoService();
        AlmacenXProductoService sa= new AlmacenXProductoService();
        Producto pr;
        pr=listaProductos.get(this.tblProductos.getSelectedRow());
        int conf = JOptionPane.showInternalConfirmDialog(this.getRootPane(), "Esta seguro que desea eliminar el registro?", "Aviso!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        if (JOptionPane.OK_OPTION == conf)
        {
            if (prods.isInReceta(pr.getIdproducto())){
                 JOptionPane.showInternalMessageDialog(this.getRootPane(), "El producto pertenece a una receta, no se puede eliminar", "Aviso", JOptionPane.WARNING_MESSAGE);
            }
            //verificar si hay stock
            else{ 
                if(prods.Stock(pr.getIdproducto())>0)
                   JOptionPane.showInternalMessageDialog(this.getRootPane(), "El producto cuenta con stock mayor a cero, no se puede eliminar", "Aviso", JOptionPane.WARNING_MESSAGE);
                else {
                    //Verificar si tiene un documento pendiente (movimiento de material,orden de produccion, orden de compra, solicitud de venta)
                     this.listaProductos.remove(pr);
                     this.sp.eliminar(pr.getIdproducto());
                }
           
            }
        }
        this.RefrescarTabla();
        this.inhabilitaBotones();
                                                
    }//GEN-LAST:event_btnEliminarPActionPerformed

    private void btnEditarPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarPActionPerformed
        // TODO add your handling code here:
        
        //Obtengo el objeto seleccionado
        Producto pr;
        pr=listaProductos.get(tblProductos.getSelectedRow());
        
        //Instancio ventana
       ModulosT_PRO.ventanaPreoductosEdita = new ModulosT_PRO_ProductosEdita1(pr);
        this.getParent().add(ModulosT_PRO.ventanaPreoductosEdita);
        
        Dimension desktopSize = this.getParent().getSize();
        Dimension jInternalFrameSize = ModulosT_PRO.ventanaPreoductosEdita.getSize();
        ModulosT_PRO.ventanaPreoductosEdita.setLocation((desktopSize.width - jInternalFrameSize.width) / 2,
            (desktopSize.height - jInternalFrameSize.height)/4 );
        ModulosT_PRO.ventanaPreoductosEdita.show();
        this.dispose();
        

    }//GEN-LAST:event_btnEditarPActionPerformed

    private void tblProductosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblProductosMouseClicked
        // TODO add your handling code here:
         if(evt.getClickCount()>=1)
        {
            this.prod= this.listaProductos.get(this.tblProductos.getSelectedRow());
            this.habilitaBotones(); 
        } 
    }//GEN-LAST:event_tblProductosMouseClicked

    private void btnProveedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnProveedorActionPerformed
        // TODO add your handling code here:
          //Obtengo el objeto seleccionado
        Producto pr;
        pr=listaProductos.get(tblProductos.getSelectedRow());
        int idPr=pr.getToTipoProducto().getIdtipoproducto();
        if (idPr==1) //si es insumo
        {
            //Instancio la ventana 
            ModulosT_PRO.detalleProveedor = new DetalleProveedores(pr);
            this.getParent().add(ModulosT_PRO.detalleProveedor);
            Dimension desktopSize = this.getParent().getSize();
            Dimension jInternalFrameSize = ModulosT_PRO.detalleProveedor.getSize();
            ModulosT_PRO.detalleProveedor.setLocation((desktopSize.width - jInternalFrameSize.width) / 2,
                (desktopSize.height - jInternalFrameSize.height)/4 );
            ModulosT_PRO.detalleProveedor.show();
            ModulosT_PRO.AdmProductos=null;
            this.dispose();
        }
        else
         JOptionPane.showInternalMessageDialog(this.getRootPane(), "Solo puede editarse proveedores a Insumos", "Aviso", JOptionPane.WARNING_MESSAGE);
    }//GEN-LAST:event_btnProveedorActionPerformed

    private void btnAlmacenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlmacenActionPerformed
        // TODO add your handling code here:
        //Obtengo el objeto seleccionado
        Producto pr;
        pr = listaProductos.get(tblProductos.getSelectedRow());
        //Instancio la ventana
        ModulosT_PRO.detalleAlmacen = new DetalleAlmacenes(pr);
        this.getParent().add(ModulosT_PRO.detalleAlmacen);
        Dimension desktopSize = this.getParent().getSize();
        Dimension jInternalFrameSize = ModulosT_PRO.detalleAlmacen.getSize();
        ModulosT_PRO.detalleAlmacen.setLocation((desktopSize.width - jInternalFrameSize.width) / 2,
                (desktopSize.height - jInternalFrameSize.height) / 4);
        ModulosT_PRO.detalleAlmacen.show();
        ModulosT_PRO.AdmProductos = null;
        this.dispose();
    }//GEN-LAST:event_btnAlmacenActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
         Carga_Masiva_Pro cargaMasiva = new Carga_Masiva_Pro();
                this.getParent().add(cargaMasiva);
                  Dimension desktopSize = this.getParent().getSize();
                Dimension jInternalFrameSize = cargaMasiva.getSize();
                cargaMasiva.setLocation((desktopSize.width - jInternalFrameSize.width) / 2,
                        (desktopSize.height - jInternalFrameSize.height) / 4);
                cargaMasiva.show();
    }//GEN-LAST:event_jButton1ActionPerformed
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAlmacen;
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnEditarP;
    private javax.swing.JButton btnEliminarP;
    private javax.swing.JButton btnLimpiar;
    private javax.swing.JButton btnNuevo;
    private javax.swing.JButton btnProveedor;
    private javax.swing.JButton btnSalir;
    private javax.swing.JComboBox cmbTipoProd;
    private javax.swing.JButton jButton1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblProducto;
    private javax.swing.JLabel lblTipoProducto;
    private javax.swing.JTable tblProductos;
    private javax.swing.JTextField txtDescripcion;
    // End of variables declaration//GEN-END:variables
}
